home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 5
/
Gekikoh Dennoh Club Vol. 5 (Japan).7z
/
Gekikoh Dennoh Club Vol. 5 (Japan) (Track 01).bin
/
internet
/
tcppack
/
tcppackb.lzh
/
src
/
libnetwork
/
h2n_n2h.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-10
|
2KB
|
92 lines
/*
* h2n_n2h.c
*
* Copyright (C) 1994 First Class Technology.
*/
#include<stdio.h>
#include<sys/param.h>
#ifdef __BIG_ENDIAN__
/************************************************
* *
************************************************/
unsigned long
htonl (unsigned long hostlong)
{
return hostlong;
}
/************************************************
* *
************************************************/
unsigned short
htons (unsigned short hostshort)
{
return hostshort;
}
/************************************************
* *
************************************************/
unsigned long
ntohl (unsigned long netlong)
{
return netlong;
}
/************************************************
* *
************************************************/
unsigned short
ntohs (unsigned short netshort)
{
return netshort;
}
#endif
#ifdef __LITTLE_ENDIAN__
/************************************************
* *
************************************************/
unsigned long
htonl (unsigned long hostlong)
{
unsigned long result;
result = (((hostlong & 0xff) << 24)
| ((hostlong & 0xff00) << 8)
| ((hostlong & 0xff0000) >> 8)
| ((hostlong & 0xff000000) >> 24));
return result;
}
/************************************************
* *
************************************************/
unsigned short
htons (unsigned short hostshort)
{
return (hostshort >> 8) | (hostshort << 8);
}
/************************************************
* *
************************************************/
unsigned long
ntohl (unsigned long netlong)
{
return htonl (netlong);
}
/************************************************
* *
************************************************/
unsigned short
ntohs (unsigned short netshort)
{
return ntohl (netshort);
}
#endif